-- card: 57358 from stack: in.0 -- bmap block id: 52845 -- flags: 0000 -- background id: 51853 -- name: newInHyperTalk ----- HyperTalk script ----- on closeCard lock screen put empty into myLine put empty into cd fld "Phrase" put empty into cd fld "WhatItIs" put empty into cd fld "Definition" hide cd fld "Examples" set scroll of cd fld "Examples" to 0 set scroll of cd fld "List" to 0 unlock screen with visual wipe left end closeCard function getchunk inWord,myDict put return & inWord & return into inWord put (number of lines in char 1 to (offset(inWord,myDict)) of myDict)+1 into myLines if myLines is 1 then return empty exit getChunk end if put line myLines to (number of lines in myDict) of myDict into myStuff delete char (offset("[",myStuff)) to length(myStuff) of myStuff return myStuff end getChunk on v set visible of cd fld "ExampleList" to not visible of cd fld "ExampleList" end v on k if not the visible of cd fld "Defs" then show cd fld "WhatList" show cd fld "Defs" show cd fld "ExampleList" else hide cd fld "WhatList" hide cd fld "Defs" hide cd fld "ExampleList" end if end k -- part 1 (field) -- low flags: 01 -- high flags: 2000 -- rect: left=274 top=58 right=109 bottom=463 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 174 -- text size: 18 -- style flags: 0 -- line height: 20 -- part name: Phrase -- part 2 (field) -- low flags: 01 -- high flags: 2007 -- rect: left=44 top=58 right=266 bottom=265 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 174 -- text size: 12 -- style flags: 0 -- line height: 15 -- part name: List ----- HyperTalk script ----- on mouseUp lock screen set cursor to watch put empty into myLine put empty into cd fld "Phrase" put empty into cd fld "WhatItIs" put empty into cd fld "Definition" set scroll of cd fld "Definition" to 0 hide cd fld "Examples" unlock screen with visual wipe left lock screen put lineNo() into myLine put line myLine of me into cd fld "Phrase" put line myLine of cd fld "WhatList" into cd fld "WhatItIs" -- put line 2 to 40 of getChunk(myLine,cd fld "Defs") into cd fld "Definition" put line myLine of cd fld "Defs" into cd fld "Definition" put line 2 to 40 of getChunk(myLine,cd fld "ExampleList") into cd fld "Examples" set scroll of cd fld "Examples" to 0 unlock screen with visual wipe right end mouseUp function lineNo if the style of the target is "scrolling" then return ((item 2 of the clickloc - item 2 of the rect of the target + the scroll of the target-2) DIV textheight of the target) +1 else return ((item 2 of the clickloc - item 2 of the rect of the target) DIV textheight of the target) +1 end if end lineNo -- part 3 (field) -- low flags: 01 -- high flags: 2007 -- rect: left=274 top=130 right=240 bottom=463 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 174 -- text size: 14 -- style flags: 0 -- line height: 18 -- part name: Definition -- part 4 (field) -- low flags: 01 -- high flags: 0000 -- rect: left=274 top=110 right=129 bottom=463 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 174 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: WhatItIs -- part 5 (button) -- low flags: 00 -- high flags: A004 -- rect: left=275 top=243 right=265 bottom=464 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 174 -- text size: 12 -- style flags: 16384 -- line height: 16 -- part name: EXAMPLES ----- HyperTalk script ----- on mouseUp if cd fld "Phrase" is empty then answer "Please select a topic first." else set the visible of cd fld "Examples" to not the visible of cd fld "Examples" end if end mouseUp -- part 6 (field) -- low flags: 81 -- high flags: 2007 -- rect: left=274 top=130 right=240 bottom=463 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 174 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Examples ----- HyperTalk script ----- on mouseUp hide me end mouseUp -- part 7 (field) -- low flags: 81 -- high flags: 2007 -- rect: left=265 top=58 right=266 bottom=448 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 174 -- text size: 12 -- style flags: 0 -- line height: 15 -- part name: WhatList ----- HyperTalk script ----- on mouseUp put lineNo() into myLine put line myLine of me into cd fld "Phrase" end mouseUp function lineNo if the style of the target is "scrolling" then return ((item 2 of the clickloc - item 2 of the rect of the target + the scroll of the target) DIV textheight of the target) +1 else return ((item 2 of the clickloc - item 2 of the rect of the target) DIV textheight of the target) +1 end if end lineNo -- part 11 (field) -- low flags: 01 -- high flags: 0000 -- rect: left=0 top=4 right=25 bottom=512 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 174 -- text size: 14 -- style flags: 2304 -- line height: 18 -- part name: -- part 12 (button) -- low flags: 00 -- high flags: 2000 -- rect: left=448 top=311 right=342 bottom=498 -- title width / last selected line: 0 -- icon id / first selected line: 5233 / 5233 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: ----- HyperTalk script ----- on mouseUp lock screen go to card "HyperTalk & XCM" unlock screen with iris close end mouseUp -- part 14 (field) -- low flags: 81 -- high flags: 2004 -- rect: left=141 top=77 right=248 bottom=388 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 174 -- text size: 14 -- style flags: 0 -- line height: 15 -- part name: INSTRUCTIONS ----- HyperTalk script ----- on mouseUp set the hilite of btn "instructions" to false hide me end mouseUp -- part 15 (button) -- low flags: 00 -- high flags: 0000 -- rect: left=374 top=315 right=337 bottom=446 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Instructions ----- HyperTalk script ----- on mouseUp set the hilite of me to not the hilite of me set the visible of cd fld "instructions" to not the visible of cd fld "instructions" end mouseUp -- part 10 (field) -- low flags: 81 -- high flags: 0007 -- rect: left=0 top=266 right=342 bottom=246 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 9 -- style flags: 0 -- line height: 12 -- part name: ExampleList ----- HyperTalk script ----- on closeField put the length of me end closeField -- part 9 (field) -- low flags: 81 -- high flags: 0007 -- rect: left=0 top=266 right=342 bottom=226 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 9 -- style flags: 0 -- line height: 12 -- part name: Defs ----- HyperTalk script ----- on mouseUp put lineNo() into myLine put line myLine of me into cd fld "Phrase" put line myLine of cd fld "WhatList" into cd fld "WhatItIs" end mouseUp function lineNo if the style of the target is "scrolling" then return ((item 2 of the clickloc - item 2 of the rect of the target + the scroll of the target) DIV textheight of the target) +1 else return ((item 2 of the clickloc - item 2 of the rect of the target) DIV textheight of the target) +1 end if end lineNo -- part contents for card part 2 ----- text ----- scriptTextStyle scriptTextFont scriptTextSize scriptEditor debugger messageWatcher messageWatching variableWatcher variableWatching stacksInUse enabled (menu) name (menu) enabled (menuItem) name (menuItem) checkMark markChar textStyle (menuItem) commandChar menuMessage scroll rectangle cantPeek cantAbort dontSearch (bkgnd) marked dontSearch (card) rectangle sharedHilite fixedLineHeight dontSearch (field) dontWrap sharedText clickChunk clickLine clickText the number of marked cards the number of menus the menus the number of menuItems of  append reset menubar debug checkpoint delete enable disable open report printing mark unmark show marked cards print marked cards print (expression) print (field) print card start Using stop Using ask password ask file answer file doMenu itemname suspendStack resumeStack shrink to stretch from -- part contents for card part 6 ----- text ----- EXAMPLE: get the name of menu 5 This example is used to find out the name of a menu. It could be useful if you change the names of your menus, or even delete and append menus, changing the menubar as the user moves through your stack. EXAMPLE: set the name of menu "Places" to "Lugares" This example changes the name of a menu. In this case, it’s used to change a menu name from English to Spanish. -- part contents for card part 7 ----- text ----- Global Variable Global Variable Global Variable Global Property Global Property Global Property Global Property Global Property Global Property Global Property Menu Property Menu Property Menu Item Property Menu Item Property Menu Item Property Menu Item Property Menu Item Property Menu Item Property Menu Item Property Card Window Property Card Window Property Stack Property Stack Property Background Property Card Property Card Property Card Property Background Button Property Field Property Field Property Field Property Field Property Function Function Function Function Function Function Function Command Command Command Command Command Command Command Command Command Command Command Command Command Command Command Command Command Command Command Message Message Message Visual Effect Visual Effect -- part contents for card part 9 ----- text ----- The scriptTextStyle property sets the style of the text displayed in the script editor. The scriptTextFont property sets the font of the text displayed in the script editor. The scriptTextSize property sets the size of the text displayed in the script editor. The scriptEditor property is the name of the HyperTalk script editor that is currently in use. The debugger property is the name of the HyperTalk debugger that is currently in use. The messageWatcher property is the name of the message lister that’s currently in use. The messageWatching property tells whether messages are being watched. The variableWatcher property is the name of the variable watcher that’s currently in use. The variableWatching property tells whether variables are being watched. The stacksInUse property is a list of all the stacks in the inheritance path—that is, all the stacks that will receive a message you send to HyperCard. The enabled property tells whether a menu can be used or not. If a menu is not enabled, it is greyed out, so the user can’t select anything from it. The name property is the name of a menu. The enabled property tells whether a menu item can be used or not. If a menu item is not enabled, it is greyed out, so the user can’t select it. The name property is the name of a menu item. The checkMark property tells whether a menu item is displayed with a checkmark. The markChar property lets you assign a character to mark a menu item. The textStyle property is the text style for a menu item. The commandChar property is the command key equivalent for a menu item. The menuMessage property is the message HyperCard sends when a menu item is selected. The scroll property contains the coordinates of the visible portion of the active card window. The rectangle property is the size of the current window. The cantPeek property determines whether users can “peek” at buttons by holding down command-option. The cantAbort property determines whether users can stop handlers while they’re executing by pressing command-period. The dontSearch property determines whether HyperCard will search for text in a background. The marked property tells whether a card is marked or not. This can be used for complex searching and printing tasks. The dontSearch property determines whether HyperCard will search for text in a card. The rectangle property is the card size of the current stack. The sharedHilite property tells whether a background button’s hilite is the same for all cards in the background, or changes from card to card. The fixedLineHeight property determines whether the height of the text in a field is fixed. If fixedLineHeight is true, the line height remains fixed even if the text size is changed. The dontSearch property determines whether HyperCard will search for text in a field. The dontWrap property determines whether text will wrap around to stay within the borders of the field, or not wrap, appearing to continue past the edge of the field. The sharedText property determines whether the text in a field is the same on all cards in the background, or whether it’s different on each card. The clickChunk function returns a chunk expression for the word or phrase where the mouse was clicked. The clickLine function returns the line number in which the mouse was clicked. The clickText function returns the word or phrase in which the mouse was clicked. The number of marked cards function returns the number of marked cards in the stack. The number of menus function returns the number of menus in the menubar. The menus function returns a list of all the current menus in the menubar, separated by commas. The number of menuItems function returns the number of items in a menu. The append command appends a menu item to a menu. The reset menubar command resets all the menus to the HyperCard default menus. The debug checkpoint command sets a permanent checkpoint where the debugger will stop when executing a handler. The delete command deletes a menu item or a menu. The enable command enables a menu item or a menu. The disable command disables a menu item or a menu. The open report printing command prints a report using the report template, or shows the user the Print Report dialog. The mark command marks all the cards that meet the specified criteria. The unmark command unmarks all the cards that meet the specified criteria. The show marked cards command scans quickly through all the marked cards. The print marked cards command prints all the marked cards. The print command prints the contents of any HyperTalk expression, including containers. The print command prints a field, using the current fonts, sizes, and styles. The print card command prints a rectangular portion of a card. The start using command inserts a stack, along with all its resources, into the HyperCard inheritance path. The stop using command removes a stack from the HyperCard inheritance path. The ask password command shows an Ask dialog with a prompt, and hides the user’s response. The ask file command shows the standard Save dialog box. The answer file command shows the standard Open dialog box. The doMenu message is sent when the user chooses a menu item. It now includes the menu name, so you can have two different menus with identical menu items that act differently. The suspendStack message is sent when the user chooses a stack in another window. The resumeStack message is sent when the user returns to this stack after using a stack in another window. The shrink to effect appears to collapse the current card image to the top, bottom, or center of the card. The stretch from effect appears to pull the new card image from the top, bottom, or center of the current card. -- part contents for card part 10 ----- text ----- [ 1 EXAMPLE: set scriptTextStyle to "plain" This example would set the text style of the text in the script editor to “plain”, making it easy to read and edit. EXAMPLE: set scriptTextStyle to "extend" This example would set the text style of the text in the script editor to “extend”, stretching it out. This might make it easier to read if you’ve been working for a long time. The text style you use in the script editor is a matter of personal preference. Use this command to customize HyperCard to suit your own style. [ 2 EXAMPLE: set scriptTextFont to "Geneva" This example would set the text font of the text in the script editor to Geneva. Geneva is easy to read, and it’s standard in all Macintoshes, so anyone else looking at the scripts in your stack would see it just as it was when you were working on it. EXAMPLE: set scriptTextFont to "Futura" This example would set the text font of the text in the script editor to Futura. You might use Futura because you find it easier to read, or you might want to use a font that you have in your LaserWriter. The text font you use in the script editor is a matter of personal preference. Use this command to customize HyperCard to suit your own style. [ 3 EXAMPLE: set scriptTextSize to 9 This example would set the text size of the text in the script editor to 9 point. 9 point text is somewhat harder to read, but you can fit much more text on the screen. This would be useful for complex handlers, when you want to see as much of the handler as possible at a time. EXAMPLE: set scriptTextSize to 18 This example would set the text size of the text in the script editor to 18 point. 18 point text is often easier to read than smaller sizes; however, you can’t see as much on the screen at one time as you can with smaller sizes. The text size you use in the script editor is a matter of personal preference. Use this command to customize HyperCard to suit your own style. [ 4 EXAMPLE: set scriptEditor to "CustomEdit" This command tells HyperCard to use a special XCMD to provide you with a different script editor. The script editor that comes with HyperCard is an XCMD; however, if you’d like to use a different one, you can use this command to change it. You might choose to use a different script editor that offers different formatting options, for example, or a different set of menus. [ 5 EXAMPLE: set debugger to "CustomDebug" This command tells HyperCard to use a special XCMD to provide you with a different debugger. The debugger that comes with HyperCard is an XCMD; however, if you’d like to use a different one, you can use this command to change it. [ 6 EXAMPLE: set messageWatcher to "CustomMsgWatch" This command tells HyperCard to use a special XCMD to provide you with a different message lister. The message lister that comes with HyperCard is an XCMD; however, if you’d like to use a different one, you can use this command to change it. [ 7 EXAMPLE: set messageWatching to true This example tells HyperCard to track all messages, listing them in the message lister for you. Seeing the messages listed as HyperCard receives them can help you determine what’s triggering a particular action in your stack. It can also be very educational. EXAMPLE: set messageWatching to false This example tells HyperCard to stop tracking all messages and listing them in the message lister for you. Most of the time, you don’t need to see the messages being sent to HyperCard. They can distract you and slow down the execution of your scripts. You’ll probably only set messageWatching to true when you’re trying to trace the inner workings of a handler. [ 8 EXAMPLE: set variableWatcher to "CustomVarWatch" This command tells HyperCard to use a special XCMD to provide you with a different variable watcher. The variable watcher that comes with HyperCard is an XCMD; however, if you’d like to use a different one, you can use this command to change it. [ 9 EXAMPLE: set variableWatching to true This example tells HyperCard to keep track of all your variables, listing them in the variable watcher for you. Watching the variables’ contents change can help you see what’s going on in a handler. EXAMPLE: set variableWatching to false This example tells HyperCard to stop tracking all your variables and listing them in the variable watcher. Most of the time, you don’t need to see the variables while HyperCard is executing a handler. They can distract you and slow down the execution of your scripts. You’ll probably only set variableWatching to true when you’re trying to trace the inner workings of a handler. [ 10 EXAMPLE: put stacksInUse into cd fld "ResourceStacks" This example gets the list of all the stacks in the current inheritance path and puts the list into a card field. This would allow the user to see which stacks’ resources and handlers are available. EXAMPLE: if "Icon Collection" is in stacksInUse then set the icon of btn id 15 to "StarryNight" This example checks to see whether a particular stack is in the current inheritance path. If it is, then that stack’s resources (including icons, as in this example) are available for this stack to use, and the handler can go ahead an use an icon from the “Icon Collection” stack. [ 11 EXAMPLE: get the enabled of menu "Goodies" This example is used to find out whether the “Goodies” menu is enabled or not. If the menu is enabled, the container “it” will contain “true”. EXAMPLE: set the enabled of menu "Chapters" to false This example disables the “Chapters” menu. It’s a good idea to disable menus when it would be inappropriate for the user to select them. [ 12 EXAMPLE: get the name of menu 5 This example is used to find out the name of a menu. It could be useful if you change the names of your menus, or even delete and append menus, changing the menubar as the user moves through your stack. EXAMPLE: set the name of menu "Places" to "Lugares" This example changes the name of a menu. In this case, it’s used to change a menu name from English to Spanish. [ 13 EXAMPLE: get the enabled of menuItem "Basic Menu" of menu "Menu Cards" This example is used to find out whether the “Basic Menu” menu item is enabled or not. If the menu item is enabled, the container “it” will contain “true”. EXAMPLE: set the enabled of menuItem "Chapter 5" of menu "Chapters" to false This example disables the “Chapter 5” menu item. It’s a good idea to disable menus when it would be inappropriate for the user to select them. In this example, the user hasn’t completed the prerequisites for Chapter 5, so the handler disables the menu item to keep the user from choosing it by mistake. [ 14 EXAMPLE: get the name of menuItem 3 of menu 5 This example is used to find out the name of a menu item. It could be useful if you change the names of your menu items, or even delete and append menu items, changing your menus as the user moves through your stack. EXAMPLE: set the name of menuItem "Chicago" of menu "Places" to "Guadalajara" This example changes the name of a menu item. In this case, it’s used to change a menu item from an American city to a city in Mexico. [ 15 EXAMPLE: set the checkMark of menuItem "Text Arrows" of menu "Preferences" to true This example places a checkmark next to a menu item. This can be useful to remind a user which option she’s chosen. For example, here, the checkmark tells the user that the global textArrows property is currently set to true. EXAMPLE: set the checkMark of menuItem "Text Arrows" of menu "Preferences" to false This example removes the checkmark next to a menu item. Here, the checkmark tells the user that the global textArrows property is currently set to false. [ 16 EXAMPLE: set the markChar of menuItem "Purple" of menu "Colors" to "•" This example lets you assign a character other than a checkmark to set off a menu choice. In this case, the menu item is marked with a bullet. [ 17 EXAMPLE: set the textStyle of menuItem "Strawberry" of menu "Ice Cream" to "Bold" This example sets the text style for a menu item to Bold. This draws attention to the menu item and makes it stand out. Generally, you’ll want to leave the text style of menu items plain. [ 18 EXAMPLE: set the commandChar of menuItem "Rocky Road" of menu "Ice Cream" to "R" This example sets the command key equivalent of a menu item. In this case, when the user types Command-R, the menu item “Rocky Road” will be activated. [ 19 EXAMPLE: set the menuMessage of menuItem "Find in script" of menu "My tools" to "searchScript" This example tells HyperCard what handler to execute when a menu item is chosen. In this case, the user has a menu called “My tools”. This command sends the message “searchScript” to HyperCard when the “Find in script” item is chosen from the menu. EXAMPLE: set menuMsg of menuItem "Eraser" of menu "Paint Menu" to "choose eraser tool" This example chooses a paint tool. The flexibility of HyperCard’s menu commands allows you to create custom menus with your favorite tools and handlers. [ 20 EXAMPLE: get the scroll of the card window This example finds out the top left corner visible area of the card. You can use this when the user is viewing a portion of the card to determine what part of the window they’re looking at. EXAMPLE: set the scroll of the card window to 0,0 This example resets the scroll of the card to the upper left corner. This way, you can be sure that users will always see the same region of the card when they first come to it. EXAMPLE: set the scroll of the card window to 100,100 This example sets the card scroll to 100 pixels from the left of the card and 100 pixels from the top. You might use this technique to allow a user to click on a button to scroll around a card. [ 21 EXAMPLE: set the rectangle of the card window to "100,100,150,150" This example resizes the card window. You might want to resize the card window to hide and show parts of the card. [ 22 EXAMPLE: set the cantPeek of this stack to true This example sets the cantPeek property of the current stack to true. With cantPeek set to true, the user can’t use Command-Option to find all the buttons on a card. This is useful in adventure game stacks, for example, when you want the user to figure out where to click. Usually, you’ll want to make your buttons stand out, so the user knows where to click. EXAMPLE: set the cantPeek of this stack to false This example sets the cantPeek property of the current stack to false. With cantPeek set to false, the user can “peek” at all the buttons on a card by pressing Command-Option. When you want to make sure you don’t miss any buttons in a stack, you’ll want to set the cantPeek to false. [ 23 EXAMPLE: set the cantAbort of this stack to true This example prevents the user from pressing Command-Period to stop a handler while it’s executing. This command can be very dangerous—if you set the cantAbort property to true, then execute a handler with an endless loop, you’ll probably have to restart your machine to be able to use HyperCard again. [ 24 EXAMPLE: set the dontSearch of this background to true This example tells HyperCard to ignore any text on this background when it’s searching for text. For example, you might have a stack for keeping track of your video cassettes, with two backgrounds: one listing the contents of each cassette, and one listing your favorite movie stars. You could set the dontSearch of the Movie Star background to true, so any time you Find something, HyperCard will only look in the Cassette Contents, and never in the list of movie stars. This can speed up searches and keep HyperCard from finding irrelevant references. [ 25 EXAMPLE: set the marked of this card to true This command sets the marked property of the current card to true. For example, if you have a stack containing all your business contacts, you might have a background button called “Mark”. During the day, as you make sales calls, you can use the button to mark any clients that need further attention. At the end of the day, you could print a report of all the marked cards. [ 26 EXAMPLE: set the dontSearch of this card to true This example tells HyperCard not to search any of the text on the current card when it’s performing searches. For example, you might have a stack listing your favorite restaurants. You have added a card to the end listing restaurants you’d like to try in the future. You could set the dontSearch of this last card to true, so that anytime you use HyperCard’s Find command, it will skip any of the restaurants listed on this card. [ 27 EXAMPLE: get the rectangle of this card This example gets the card size, in pixels, for the current stack. The card size is the same for all cards in a stack. This example can tell you whether the cards in this stack are bigger or smaller than typical cards. EXAMPLE: set the rect of this card to "0,0,512,342" This example sets the size of the cards in this stack to the size of typical cards—the size of a 9” screen. You might do this in a stack that had been designed for use on larger screens but was later used on 9” screens. [ 28 EXAMPLE: set the sharedHilite of background button "Taxable" to false This example sets the sharedHilite property of a button to false, so its hilite will change from card to card. This example might be used in an invoicing stack containing a card for each customer. Since not all customers would be subject to sales tax, you add a background checkbox button called “Taxable”. By setting its sharedHilite property to false, the hilite of the button is stored on each card. When you look up a customer in your stack, the button will show whether that customer is subject to sales tax. EXAMPLE: set the sharedHilite of bg btn "Show Notes" to true This example sets the sharedHilite property of a button to true, so its hilite will not change from card to card. You could use this example in a contact stack with a hidden Notes field. If the “Show Notes” button is hilited, each time a card is opened, the hidden Notes field will be shown. The hilite of the button will remain the same for all cards of the background. [ 29 EXAMPLE: get the fixedLineHeight of card field "Note" This example finds out whether the line height of a card field is fixed. EXAMPLE: set the fixedLineHeight of fld "Address" to false This example can be useful if you have different sizes of text in a single field—this way, 9 point text will have an appropriate line height, while 18 point text in the same field will have its own line height. [ 30 EXAMPLE: set the dontSearch of background field "Description" to true This example tells HyperCard not to search any of the text in a certain background field when it’s performing searches. For example, you might have a stack listing the artworks at a museum. Each card lists the title of the piece, the artist’s name, a list of keywords, and a lengthy description. Since the text in the Description field is so long, searching that field could slow things down considerably. By setting the dontSearch property of that field to true, you tell HyperCard to only search the Title, Artist, and Keyword fields, significantly speeding up searches. EXAMPLE: set the dontSearch of cd fld "Don't Forget" to true This example tells HyperCard not to search the text in this field. In this example, the “Don’t Forget” field is a card field attached to a customer in a Contact stack. Since it holds a temporary reminder, the user doesn’t want HyperCard to look at this text during searches. [ 31 EXAMPLE: set the dontWrap of card field "Topics" to true This example sets the dontWrap property of a field to true. This way, if any of the topics is too long to fit on one line of the field, it will not wrap to the next line, which could confuse the user, since the second part of the topic name could appear to be a new topic. EXAMPLE: set the dontWrap of card field "Outline" to true In this example, the Outline field contains a writer’s first pass at a story. By setting the dontWrap property to true, the writer sees just the first few words of each paragraph. [ 32 EXAMPLE: set the sharedText of background field "Title" to true This example sets the sharedText property of a field to true, causing the text in the field to be the same on all the cards in this background. This can be useful for any text that stays the same on all cards in a background, such as a title or an instructions field. EXAMPLE: set the sharedText of field "Section" to false This example sets the sharedText property of a field to false, so that the text in the field changes from card to card. Most fields will have different text on each card. The sharedText property only applies to background fields. [ 33 EXAMPLE: put the clickChunk This example returns the chunk expression telling where the user clicked in a locked field. For example, it might return “char 18 to 23 of card field 3”. You can use this technique to find out what word or group of words was clicked by the user. EXAMPLE: if the textStyle of the clickChunk is bold then go card "Glossary" This example lets you check the style of the word that was clicked. If you have set up your stack so that all the words defined in the glossary are in bold face, HyperTalk can determine whether the word is in the glossary before going to that card. [ 34 EXAMPLE: show card field (word 2 of the clickLine) In this example, HyperCard will show a card field corresponding to the line that was clicked.The function “the clickLine” would return something like “line 3 of bkgnd field 1”, and in this example, HyperCard would show card field 3, corresponding to the user’s click on line 3 of the background field. EXAMPLE: select the clickLine This example selects the line where the user clicked, hiliting it and providing visual feedback to the user. [ 35 EXAMPLE: show card field (the clickText) This example shows a card field with the same name as the text that was clicked. For example, if the user clicked on the word “Macintosh”, this command would show the card field “Macintosh”. EXAMPLE: go card (the clickText) This example goes to a card with the same name as the text that was clicked. You could use this for a “Table of Contents” field. The field would list all the cards by name, and the user could click on any card name to view that card. [ 36 EXAMPLE: put the number of marked cards into numMarked This example puts the number of marked cards into a variable. You can choose to mark cards for a variety of reasons. For example, in a Contacts stack, you might mark the card of each client you wish to call this week. You could use the number of marked cards function to find out how many calls you need to make this week. [ 37 EXAMPLE: if the number of menus = 4 then append menuItem "General" to menu "Help" This example adds a new menu to the menubar. First, it checks how many menus there are in the menubar. If there are 4, the Help menu hasn’t been added yet, so it adds the Help menu to the menubar. EXAMPLE: if the number of menus < 14 then append "East" to menu "Region" else answer "Sorry, there are too many menus already!" This example adds a new menu to the menubar after checking how many menus there are. If there are 14 menus or more in the menubar already, it tells the user there are too many menus. Otherwise, it adds the new Region menu. [ 38 EXAMPLE: put the menus into myMenuList This example puts a comma-separated list of all the menus into a variable. The information can then be used to determine what menus are currently showing, and to find out the names of those menus. EXAMPLE: on openCard if item 5 of the menus is "Events" then delete menu "Events" append menuItem "By Day" to menu "View" append menuItem "By Week" to menu "View" append menuItem "By Month" to menu "View" end if end openCard This example changes the menus when a card is opened. This example might be used in an Appointment Scheduler stack. When the card is opened, the script checks the menus. If the fifth menu is called Events, it deletes that menu and creates a new one called View. [ 39 EXAMPLE: put the number of menuItems in menu 5 into menuLength This examples puts the number of items in menu 5 into a variable. You can use this information to find out whether you’ve already appended a certain menu item, or to find out whether the menu is getting so long that it will be difficult to use. EXAMPLE: put the number of menuItems in menu "Font" into numFonts This example finds out how many fonts are listed in the font menu. [ 40 EXAMPLE: append menuItem "East" to menu "Region" append menuItem "West" to menu "Region" append menuItem "North" to menu "Region" append menuItem "South" to menu "Region" This example adds menu items to the Region menu. The first time you append a menu item to a menu, you create the menu at the same time. [ 41 EXAMPLE: on openStack reset menubar end openStack This example resets the menubar to HyperCard’s standard menus when the stack is opened. [ 42 EXAMPLE: if myVar > 100 then debug checkpoint This example shows the debugging window if the value of myVar is over 100. repeat with x = 1 to 1000 doMyOtherHandler debug checkpoint end repeat This example brings up the debugging window after each execution of the “doMyOtherHandler” handler. [ 43 EXAMPLE: delete menu "Help" This example deletes the Help menu. EXAMPLE: on deleteCard delete menuItem (field "Appt Num") of menu "Appointments" pass deleteCard end deleteCard This example deletes a menu item when a card is deleted. You might use this technique if you were using menus to facilitate navigating between parts of a stack. [ 44 EXAMPLE: on openStack enable menu "Appointments" end openStack This example enables a menu when the stack is opened. This makes the menu available when the user is in the stack it affects. Enabling and disabling it, instead of adding it and deleting it, is both faster and less confusing for the user, since the order and number of menus in the menubar doesn’t change. EXAMPLE: if the visible of fld "Notes" then enable menuItem "Clear Notes" of menu "Contacts" This example enables a menu item (allowing users to select that menu item) if the Notes field is visible. You can use this technique to keep users from selecting menu items when the menu’s action would be inappropriate. [ 45 EXAMPLE: on closeStack disable menu "Appointments" end closeStack This example disables a menu when the stack is closed. This makes the menu unavailable when the user leaves the stack the menu affects. Enabling and disabling it, instead of adding it and deleting it, is both faster and less confusing for the user, since the order and number of menus in the menubar doesn’t change. EXAMPLE: if the visible of fld "Notes" is false then disable menuItem "Clear Notes" of menu "Contacts" This example disables a menu item (preventing users from selecting that menu item) if the “Notes” field is hidden. You can use this technique to keep users from selecting menu items when the menu’s action would be inappropriate. [ 46 EXAMPLE: on mouseUp open report printing with dialog print all cards close printing end mouseUp This example shows the user the Report dialog box, allowing the user to make changes or open a report template. Then a report is printed using the template the user picked or created. EXAMPLE: on mouseUp open report printing with template "Oscar Winners" print marked cards close printing end mouseUp This example makes use of a precreated report template. It prints a report using information from all the marked cards in the stack. [ 47 EXAMPLE: mark card 1 This example marks the first card. EXAMPLE: mark cards where field "State" is "NC" This example marks all the cards that have “NC” in the State field. You can use this technique to print cards that meet certain criteria. [ 48 EXAMPLE: unmark all cards This example unmarks all the cards in the stack. It’s a good idea to do this before marking cards, to make sure you don’t get any cards that were marked before. EXAMPLE: mark cards where field "State" contains "N" unmark cards where field "State" is "NC" This example first marks all the cards with an “N” in the State field, then unmarks all the “NC” cards, leaving all the others marked. You can use this technique to simplify searches, first marking cards, then unmarking the exceptions. [ 49 EXAMPLE: mark cards where field "Artist" is "Renoir" show marked cards In this example, an art teacher has a stack of scanned paintings. The first command marks all the cards showing Renoir paintings. The second command scans through them quickly. The professor can use this as a slide show. mark cards where fld "FollowUp" is the date show marked cards This example is used by a businesswoman. She has a Followup field in her Contact stack. First, she marks all the cards that require her attention today. Then, she uses the show marked cards command to scan through them quickly, jogging her memory and helping her prioritize them. [ 50 mark cards where fld "FollowUp" is the date print marked cards This example is used by a businesswoman. First, she marks all the cards that require her attention today. Then, she uses the print marked cards command to print a list of names and phone numbers. [ 51 EXAMPLE: print "There are " & number of marked cards & " marked cards in this stack." The print command prints the value of any HyperTalk expression. In this example, the command calculates the number of marked cards and sends the complete phrase to the printer. [ 52 EXAMPLE: print field "Reminder" This print command prints the contents of any field, using the current font, size, and style. This is especially useful for printing scrolling fields. [ 53 EXAMPLE: print card from 0,0 to 400,200 This example prints a portion of a card. EXAMPLE: print card from topleft of bg btn 1 to bottomright of bg btn 1 This example prints the portion of the card that falls within the rectangle of a background button. You could use this technique to easily position graphics on a number of cards and print that region of the card. [ 54 EXAMPLE: start using stack "My Tools" The start using command adds a stack to the inheritance path. In this example, the user has a stack called “My Tools”, containing a number of icons and utility handlers. The start using command makes all the stack script handlers and all the resources of “My Tools” available to other stacks, similar to putting them in the Home stack. [ 55 EXAMPLE: stop using stack "My Tools" In this example, the user has a stack called “My Tools”, containing a number of icons and utility handlers. The stop using command makes the handlers and resources of “My Tools” UNAVAILABLE to other stacks. [ 56 EXAMPLE: ask password "What is your password?" This example asks for the user’s password, supplying a prompt phrase. When the user types in a response, his answer will be hidden. [ 57 EXAMPLE: ask file "Please name the file:" In this example, the stack is writing the contents of a field to disk. The command shows the standard Save dialog with a special prompt phrase. [ 58 EXAMPLE: answer file "TEXT", "Please open a file:" In this example, the stack is putting the contents of a disk file into a field. The command shows the standard Open dialog with a special prompt phrase. The dialog box will only list text files, as specified in the command. [ 59 EXAMPLE: doMenu "Back", "View" doMenu "Back", "Go" These examples are from a stack containing scans of archaeological finds. The View menu allows the user to see the object from the back, front, or side. However, the user still needs to navigate through the stack. The new doMenu command allows either of the Back menu items to be chosen. The second argument tells HyperCard which menu to use. [ 60 EXAMPLE: on suspendStack disable menu "Appointments" end suspendStack This example disables a menu when the user clicks on another window. This keeps the user from choosing a menu item when it wouldn’t be appropriate. [ 61 EXAMPLE: on resumeStack disable menu "Appointments" end suspendStack This example enables a menu when the user reactivates the stack it belongs to. This allows the user to use this menu after it’s been disabled. [ 62 EXAMPLE: visual effect shrink to bottom This example makes the current card appear to collapse into the top of the new card. This could be useful to simulate a card, graphic, or chart falling over forward. EXAMPLE: visual shrink to center In this example, the current card appears to collapse into the center of the new card. This could be useful to simulate closing a scroll of paper, or to indicate returning to a menu after exploring a subject in more depth. [ 63 EXAMPLE: visual effect stretch from top This example makes the new card appear to be pulled out of the top of the current card. This could be useful for simulating pulling down a map or chart, or in an adventure game stack, to indicate moving up. EXAMPLE: visual stretch from center In this example, the new card appears to be pulled from the center of the current card. This could be useful to simulate opening a roll of paper, or to indicate going deeper into a subject. [ -- part contents for card part 11 ----- text ----- NEW COMMANDS, FUNCTIONS, & PROPERTIES IN HYPERTALK -- part contents for card part 14 ----- text ----- Click on a line in the scrolling field to the left—information about that HyperTalk expression will appear to the right. Click the Examples button for an example of how you could use the expression. CLICK THIS FIELD TO HIDE IT.